package org.jgs1904.oopbase.method;

/**
 * @author: 默苍璃
 * @date: 2022-09-13 11:37
 */
public class PrivateMethodPerson {

    private String name;
    private int birth;

    public void setBirth(int birth) {
        this.birth = birth;
    }

    public int getAge() {
        return calcAge(2022); // 调用private方法
    }

    // private方法:
    private int calcAge(int currentYear) {
        return currentYear - this.birth;
    }

}
